<div class="panel panel-default panel-intro">
    <div class="panel-heading">
        <h3 class="panel-title">文件详情</h3>
    </div>
    <div class="panel-body">
        <div class="row">
            <div class="col-md-6">
                <table class="table table-striped">
                    <tr>
                        <td><strong>文件ID：</strong></td>
                        <td>{$row.id}</td>
                    </tr>
                    <tr>
                        <td><strong>原始文件名：</strong></td>
                        <td><i class="{$row.getFileIcon()}"></i> {$row.original_name}</td>
                    </tr>
                    <tr>
                        <td><strong>存储文件名：</strong></td>
                        <td>{$row.file_name}</td>
                    </tr>
                    <tr>
                        <td><strong>文件大小：</strong></td>
                        <td>{$row.file_size_text}</td>
                    </tr>
                    <tr>
                        <td><strong>文件类型：</strong></td>
                        <td>{$row.file_type}</td>
                    </tr>
                    <tr>
                        <td><strong>文件扩展名：</strong></td>
                        <td>{$row.extension}</td>
                    </tr>
                </table>
            </div>
            <div class="col-md-6">
                <table class="table table-striped">
                    <tr>
                        <td><strong>存储配置：</strong></td>
                        <td>{$row.config.name}</td>
                    </tr>
                    <tr>
                        <td><strong>上传模块：</strong></td>
                        <td>{$row.upload_module}</td>
                    </tr>
                    <tr>
                        <td><strong>上传动作：</strong></td>
                        <td>{$row.upload_action}</td>
                    </tr>
                    <tr>
                        <td><strong>上传时间：</strong></td>
                        <td>{$row.createtime_text}</td>
                    </tr>
                    <tr>
                        <td><strong>文件状态：</strong></td>
                        <td>{$row.status_text}</td>
                    </tr>
                    <tr>
                        <td><strong>MD5值：</strong></td>
                        <td><code>{$row.md5}</code></td>
                    </tr>
                </table>
            </div>
        </div>
        
        <div class="row">
            <div class="col-md-12">
                <h4>文件访问信息</h4>
                <table class="table table-striped">
                    <tr>
                        <td><strong>文件路径：</strong></td>
                        <td><code>{$row.file_path}</code></td>
                    </tr>
                    <tr>
                        <td><strong>访问URL：</strong></td>
                        <td>
                            <a href="{$row.file_url}" target="_blank" class="btn btn-sm btn-info">
                                <i class="fa fa-external-link"></i> 查看文件
                            </a>
                            <code>{$row.file_url}</code>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        
        <div class="row">
            <div class="col-md-12">
                <div class="btn-group">
                    <a href="{$row.file_url}" target="_blank" class="btn btn-primary">
                        <i class="fa fa-external-link"></i> 查看文件
                    </a>
                    <a href="yuncunchu/file/download/ids/{$row.id}" class="btn btn-success">
                        <i class="fa fa-download"></i> 下载文件
                    </a>
                    <button type="button" class="btn btn-danger" onclick="deleteFile({$row.id})">
                        <i class="fa fa-trash"></i> 删除文件
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
function deleteFile(id) {
    if (confirm('确定要删除这个文件吗？')) {
        $.post('yuncunchu/file/del', {ids: id}, function(data) {
            if (data.code === 1) {
                Layer.msg('删除成功');
                setTimeout(function() {
                    parent.Layer.closeAll();
                }, 1000);
            } else {
                Layer.msg('删除失败：' + data.msg);
            }
        });
    }
}
</script>

